#include "test_list.h"


#ifdef TEST_VARIANT_SCANNER

#define TEST_Variant_PRINT

//#include "disable_warning.h"

#include "tools/variant.h"

//#define TEST_VARIANT_SCANNER_000
//#define TEST_VARIANT_SCANNER_001
//#define TEST_VARIANT_SCANNER_002
//#define TEST_VARIANT_SCANNER_003
//#define TEST_VARIANT_SCANNER_004
//#define TEST_VARIANT_SCANNER_005
//#define TEST_VARIANT_SCANNER_006
#define TEST_VARIANT_SCANNER_007
#define TEST_VARIANT_SCANNER_008
#define TEST_VARIANT_SCANNER_009
#define TEST_VARIANT_SCANNER_010
#define TEST_VARIANT_SCANNER_011
#define TEST_VARIANT_SCANNER_012
#define TEST_VARIANT_SCANNER_013
#define TEST_VARIANT_SCANNER_014
//#define TEST_VARIANT_SCANNER_015
#define TEST_VARIANT_SCANNER_016
#define TEST_VARIANT_SCANNER_017
#define TEST_VARIANT_SCANNER_018
#define TEST_VARIANT_SCANNER_019
#define TEST_VARIANT_SCANNER_020
#define TEST_VARIANT_SCANNER_021
#define TEST_VARIANT_SCANNER_022
#define TEST_VARIANT_SCANNER_023
#define TEST_VARIANT_SCANNER_024
#define TEST_VARIANT_SCANNER_025
#define TEST_VARIANT_SCANNER_026
#define TEST_VARIANT_SCANNER_027
#define TEST_VARIANT_SCANNER_028
#define TEST_VARIANT_SCANNER_029
#define TEST_VARIANT_SCANNER_030
#define TEST_VARIANT_SCANNER_031
#define TEST_VARIANT_SCANNER_032

using namespace variant_detail;

//------------------------------------------------------------------------------------------------------//
namespace{

    typedef variant_detail::V::I8         I8;
    typedef variant_detail::V::I16        I16;
    typedef variant_detail::V::I32        I32;
    typedef variant_detail::V::I64        I64;
    typedef variant_detail::V::U8         U8;
    typedef variant_detail::V::U16        U16;
    typedef variant_detail::V::U32        U32;
    typedef variant_detail::V::U64        U64;
    typedef variant_detail::V::F32        F32;
    typedef variant_detail::V::F64        F64;
    typedef variant_detail::V::Byte       Byte;
    typedef variant_detail::V::WChar      WChar;
    typedef variant_detail::V::Str        Str;
    typedef variant_detail::V::WStr       WStr;
    typedef variant_detail::V::Vec        Vec;
    typedef variant_detail::V::Map        Map;
    typedef variant_detail::V::Blob       Blob;
    typedef variant_detail::V::List       List;
    typedef variant_detail::V::Record     Record;
    typedef variant_detail::V::Records    Records;


    #ifdef TEST_Variant_PRINT
        void Print(const Variant&  v){  cout<< endl << ToStruct(v)      << endl; }
        void PPrint(const Variant& v){  cout<< endl << ToPythonStyle(v) << endl; }
        void HPrint(const Variant& v){  cout<< endl << ToHummanStyle(v) << endl; }
    #else
        void Print(const Variant&) {}
        void PPrint(const Variant&){}
        void HPrint(const Variant&){}
    #endif

#define ENDL "\n"


}//namespace



//------------------------------------------------------------------------------------------------------//

#ifdef TEST_VARIANT_SCANNER_000
TEST(Variant, Scanner_000)
{
     Vec vec(2,10);
     Variant val = vec;
     cout<< "\n"<<val<<endl;

}
#endif // TEST_VARIANT_SCANNER_000

#ifdef TEST_VARIANT_SCANNER_001
TEST(Variant, Scanner_001)
{
    Map m;
    m["one"] = 10;
    m["two"] = true;
    Variant val = m;
    cout<< "\n"<<val<<endl;
}
#endif // TEST_VARIANT_SCANNER_001

#ifdef TEST_VARIANT_SCANNER_002
TEST(Variant, Scanner_002)
{
      Variant val=10;
      cout<< "\n"<<val<<endl;
}
#endif // TEST_VARIANT_SCANNER_002

#ifdef TEST_VARIANT_SCANNER_003
TEST(Variant, Scanner_003)
{
    List l;
    l.push_back(10);
    l.push_back(true);
    Variant val = l;

    cout<< "\n"<<val<<endl;

    //cout <<"\n"<< ToHummanStyle(val)<<endl;
}
#endif // TEST_VARIANT_SCANNER_003

#ifdef TEST_VARIANT_SCANNER_004
TEST(Variant, Scanner_004)
{
    Variant v1; 
    v1["111"]["222"] = true;
    v1["222"]["333"] = true;

    Variant v; 
    v["count"] = Variant::Vec(3);
    v["count"][1] = v1;
    v["hello"]["foo"]["1"][3] = 10;
    v["external"]["boost"]["lib"][0]   = "filesystem";
    v["external"]["boost"]["lib"][1]   = "system";
    v["external"]["boost"]["lib"][2]   = "regex";
    v["external"]["ogre"]["hpp"][0]    = "orge.h";
    v["external"]["ogre"]["lib32"][0]  = "ogre.lib";
    v["external"]["ogre"]["lib32"][1]  = "ogre_d.lib";


    HPrint(v);
    const Str re = ToHummanStyle(v);
    const Str expec = 
        "map:"                      ENDL
        "  'count' vec:"            ENDL
        "    empty"                 ENDL
        "    map:"                  ENDL
        "      '111' map:"          ENDL
        "        '222' true"        ENDL
        "      '222' map:"          ENDL
        "        '333' true"        ENDL
        "    empty"                 ENDL
        "  'external' map:"         ENDL
        "    'boost' map:"          ENDL
        "      'lib' vec:"          ENDL
        "        \"filesystem\""    ENDL
        "        \"system\""        ENDL
        "        \"regex\""         ENDL
        "    'ogre' map:"           ENDL
        "      'hpp' vec:"          ENDL
        "        \"orge.h\""        ENDL
        "      'lib32' vec:"        ENDL
        "        \"ogre.lib\""      ENDL
        "        \"ogre_d.lib\""    ENDL
        "  'hello' map:"            ENDL
        "    'foo' map:"            ENDL
        "      '1' vec:"            ENDL
        "        empty"             ENDL
        "        empty"             ENDL
        "        empty"             ENDL
        "        10";    

    EXPECT_EQ(expec, re );

}
#endif // TEST_VARIANT_SCANNER_004

#ifdef TEST_VARIANT_SCANNER_005
TEST(Variant, Scanner_005)
{
    //Variant v = Record("one", true);

    Variant v = Vec();
    HPrint(v);

    const Str re = ToHummanStyle(v);
    const Str expec = "vec is empty";
    EXPECT_EQ(expec, re );
}
#endif // TEST_VARIANT_SCANNER_005

#ifdef TEST_VARIANT_SCANNER_006
TEST(Variant, Scanner_006)
{
    Variant v = Record("one", true);
    HPrint(v);
    const Str re = ToHummanStyle(v);
    const Str expec = "Record(\"one\" : true)";
    EXPECT_EQ(expec, re );
}
#endif // TEST_VARIANT_SCANNER_006

#ifdef TEST_VARIANT_SCANNER_007
TEST(Variant, Scanner_007)
{
    Variant v;
    v[0] = Record("one", true);
    v[0] = Record("two", true);
    HPrint(v);
//    const Str re = ToHummanStyle(v);
//    const Str expec = "Record(\"one\" : true)";
//    EXPECT_EQ(expec, re );
}
#endif // TEST_VARIANT_SCANNER_007

#ifdef TEST_VARIANT_SCANNER_008
#endif // TEST_VARIANT_SCANNER_008

#ifdef TEST_VARIANT_SCANNER_009
#endif // TEST_VARIANT_SCANNER_009

#ifdef TEST_VARIANT_SCANNER_010
#endif // TEST_VARIANT_SCANNER_010

#ifdef TEST_VARIANT_SCANNER_011
#endif // TEST_VARIANT_SCANNER_011

#ifdef TEST_VARIANT_SCANNER_012
#endif // TEST_VARIANT_SCANNER_012

#ifdef TEST_VARIANT_SCANNER_013
#endif // TEST_VARIANT_SCANNER_013

#ifdef TEST_VARIANT_SCANNER_014
#endif // TEST_VARIANT_SCANNER_014

#ifdef TEST_VARIANT_SCANNER_015
TEST(Variant, Scanner_015)
{
    Variant v;
    v[0] = Variant::I32(0);
    v[1] = true;
    v[2][0] = Variant::I32(1);
    v[2][1][0] ="hello";
    v[2][1][1] ="world";
    v[3][0][0] = Variant::I32(23);
    v[3][0][1][0] = Variant::I32(24);
    v[3][0][1][1] = true;
    v[3][1] = Variant::I32(3);
    v[3][2] = true;

#if 0
vec:
|--0
|--true
|--vec:
|   |--1
|   |--vec:
|       |--"hello"
|       |--"world"
|--vec:
    |--vec:
    |   |--23
    |   |--vec:
    |       |--24
    |       |--true
    |--3
    |--true
#endif

    cout << ToLineStyle(v) << endl;
}
#endif // TEST_VARIANT_SCANNER_015

#ifdef TEST_VARIANT_SCANNER_016
#endif // TEST_VARIANT_SCANNER_016

#ifdef TEST_VARIANT_SCANNER_017
#endif // TEST_VARIANT_SCANNER_017

#ifdef TEST_VARIANT_SCANNER_018
#endif // TEST_VARIANT_SCANNER_018

#ifdef TEST_VARIANT_SCANNER_019
#endif // TEST_VARIANT_SCANNER_019

#ifdef TEST_VARIANT_SCANNER_020
#endif // TEST_VARIANT_SCANNER_020

#ifdef TEST_VARIANT_SCANNER_021
#endif // TEST_VARIANT_SCANNER_021

#ifdef TEST_VARIANT_SCANNER_022
#endif // TEST_VARIANT_SCANNER_022

#ifdef TEST_VARIANT_SCANNER_023
#endif // TEST_VARIANT_SCANNER_023

#ifdef TEST_VARIANT_SCANNER_024
#endif // TEST_VARIANT_SCANNER_024

#ifdef TEST_VARIANT_SCANNER_025
#endif // TEST_VARIANT_SCANNER_025

#ifdef TEST_VARIANT_SCANNER_026
#endif // TEST_VARIANT_SCANNER_026

#ifdef TEST_VARIANT_SCANNER_027
#endif // TEST_VARIANT_SCANNER_027

#ifdef TEST_VARIANT_SCANNER_028
#endif // TEST_VARIANT_SCANNER_029

#ifdef TEST_VARIANT_SCANNER_030
#endif // TEST_VARIANT_SCANNER_030

#ifdef TEST_VARIANT_SCANNER_031
#endif // TEST_VARIANT_SCANNER_031

#ifdef TEST_VARIANT_SCANNER_032
#endif // TEST_VARIANT_SCANNER_032

#endif

//#include "default_warning.h"

